﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Text;
using NHibernate.Criterion;
using Common;

namespace Web.helper
{
    /// <summary>
    /// 左侧菜单
    /// </summary>
    public static class HtmlMenu
    {
        public static string Menu(this HtmlHelper helper,int role_id)
        {
            //B_Navigation b_nav = new B_Navigation();
            ////先查询出所有的一级菜单
            //List<SearchTemplate> nav_st = new List<SearchTemplate>()
            //        {
            //            new SearchTemplate(){key="parent_id",value=0,searchType=Common.EnumBase.SearchType.Eq},
            //            new SearchTemplate(){key="is_lock",value="√",searchType=Common.EnumBase.SearchType.Eq}
            //        };
            //List<Order> order = new List<Order>() { Order.Asc("sort_id") };
            //var list_nav = b_nav.GetList(nav_st, order);
            StringBuilder sb = new StringBuilder();
            //B_Manager_role_value b_mrv = new B_Manager_role_value();
            string link_url = "";
            string title = "一级菜单";
            string icon_url = "";
                sb.Append("<li class='active'>");
                sb.Append("<a href=\"" + link_url + "\">");
                sb.Append(icon_url);
                sb.Append("<span class=\"nav-label\">" + title + "</span>");
                sb.Append("<span class=\"fa arrow\"></span>");
                sb.Append("</a>");
                sb.Append("<ul class=\"nav nav-second-level\">");
                string sub_nav_link_url = "/Admin/Lesson";
                string sub_nav_sort_id = "1";
                string sub_nav_icon_url = "<i class=\"fa fa-file-text\"></i>";
                string sub_nav_title = "课程管理";
                //查询二级菜单
                sb.Append("<li>");
                sb.Append("<a class=\"J_menuItem\" href=" + sub_nav_link_url + " data-index=" + sub_nav_sort_id + ">" + sub_nav_icon_url + "</i>" + sub_nav_title + "</a>");
                sb.Append("</li>");


                sub_nav_link_url = "/Admin/LessonCategory";
                 sub_nav_sort_id = "2";
                 sub_nav_icon_url = "<i class=\"fa fa-file-text\"></i>";
                 sub_nav_title = "类目管理";
                sb.Append("<li>");
                sb.Append("<a class=\"J_menuItem\" href=" + sub_nav_link_url + " data-index=" + sub_nav_sort_id + ">" + sub_nav_icon_url + "</i>" + sub_nav_title + "</a>");
                sb.Append("</li>");



                sub_nav_link_url = "/Admin/teacher";
                sub_nav_sort_id = "3";
                sub_nav_icon_url = "<i class=\"fa fa-file-text\"></i>";
                sub_nav_title = "讲师管理";
                sb.Append("<li>");
                sb.Append("<a class=\"J_menuItem\" href=" + sub_nav_link_url + " data-index=" + sub_nav_sort_id + ">" + sub_nav_icon_url + "</i>" + sub_nav_title + "</a>");
                sb.Append("</li>");


                sub_nav_link_url = "/Admin/LessonSeries";
                sub_nav_sort_id = "4";
                sub_nav_icon_url = "<i class=\"fa fa-file-text\"></i>";
                sub_nav_title = "系列管理";
                sb.Append("<li>");
                sb.Append("<a class=\"J_menuItem\" href=" + sub_nav_link_url + " data-index=" + sub_nav_sort_id + ">" + sub_nav_icon_url + "</i>" + sub_nav_title + "</a>");
                sb.Append("</li>");


                sub_nav_link_url = "/Admin/Recommend";
                sub_nav_sort_id = "5";
                sub_nav_icon_url = "<i class=\"fa fa-file-text\"></i>";
                sub_nav_title = "热门推荐";
                sb.Append("<li>");
                sb.Append("<a class=\"J_menuItem\" href=" + sub_nav_link_url + " data-index=" + sub_nav_sort_id + ">" + sub_nav_icon_url + "</i>" + sub_nav_title + "</a>");
                sb.Append("</li>");
                sb.Append("</ul>");
                sb.Append("</li>");

            
            return sb.ToString();
        }
    }
}